package com.zhiyou.service.impl;

import com.zhiyou.dao.UserListDao;
import com.zhiyou.model.User;
import com.zhiyou.service.UserListService;

import java.util.HashMap;
import java.util.List;

public class UserLisetServiceImp implements UserListService {
    private UserListDao uld = new UserListDao();
    @Override
    public int getUserListNum(HashMap<String, String> keywordMap) {
        return uld.getUserListNum(keywordMap);
    }

    @Override
    public List<User> getUser(int pageNo, int pageSize,HashMap<String, String> keywordMap) {
        List<User> users = uld.getUser(pageNo, pageSize,keywordMap);
        //把role数据存入user中的role中
        users = uld.getUserRole(users);
        return users;
    }

    @Override
    public void deleteById(int uid) {
        uld.deleteById(uid);
    }

    @Override
    public void addNew(User user) {
        uld.addNew(user);
    }

    @Override
    public User selectById(int uid) {
        return uld.selectById(uid);
    }

    @Override
    public void updateNew(User user) {
        uld.updateNew(user);
    }
}
